package com.pz.gulimall.auth.feign;

import com.pz.gulimall.auth.vo.res.ShopCarItemResVo;
import com.pz.gulimall.common.to.ShopCarItemTo;
import com.pz.gulimall.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotEmpty;
import java.util.List;

@FeignClient("gulimall-product")
public interface ProductFeign {
    @GetMapping("/product/skusaleattrvalue/getSaleAttr/{skuId}")
    R getSaleAttr(@PathVariable("skuId") Long skuId);

    @PostMapping("/product/skusaleattrvalue/getSaleAttrBatch")
    R getSaleAttrBatch(@RequestBody List<Long> skuIds);

    @RequestMapping("/product/skuinfo/info/{skuId}")
    R info(@PathVariable("skuId") Long skuId);

    /**
     *  批量获取商品信息
     * @param skuIds skuId数组
     */
    @PostMapping("/product/skuinfo/list/byIds")
    R getByIds(@RequestBody @NotEmpty List<Long> skuIds);

    @RequestMapping("/product/shopcar/save")
    R save(@RequestBody List<ShopCarItemTo> shopcarItems);

    @GetMapping("/product/shopcar/query/{loginId}")
    R getByLoginId(@PathVariable("loginId") String loginId);

    @PostMapping("/product/shopcar/query/batch")
    R queryBatch(@RequestBody List<String> loginIds);

    @GetMapping("/product/shopcar/del/{loginId}")
    R del(@PathVariable("loginId") String loginId, @RequestBody List<Long> skuId);
}
